
import request from '@/utils/request'

const PREFIX= '/role'

const ROLE_API = {
    create: (data) =>{
        return request({
            url:'/role/create',
            method:'post',
            data:data
        })
    },
    list:(keyword,pageSize,pageNum)=>{
        return request({
            url:`${PREFIX}/list?keyword=${keyword}&pageSize=${pageSize}&pageNum=${pageNum}`,
            method:'get',
        })
    },

    delete:(data)=>{
        return request({
            url:`${PREFIX}/delete`,
            method:'post',
            data:data
        })
    },
    update:(id,data)=>{
        return request({
            url:`${PREFIX}/update/${id}`,
            method:'post',
            data:data
        })
    },
    listMenu:(id)=>{
        return request({
            url:`${PREFIX}/listMenu/${id}`,
            method:'get',
        })
    },
    listResource:(id)=>{
        return request({
            url:`${PREFIX}/listResource/${id}`,
            method:'get',
        })
    },
    allocMenu:(data)=>{
        return request({
            url:`${PREFIX}/allocMenu`,
            method:'post',
            data:data
        })
    },
    allocResource:(data)=>{
        return request({
            url:`${PREFIX}/allocResource`,
            method:'post',
            data:data
        })
    },
    treeMenuList:()=>{
        return request({
            url:`${PREFIX}/treeMenuList`,
            method:'get',
        })
    },
    treeResourceList:()=>{
        return request({
            url:`${PREFIX}/treeResourceList`,
            method:'get',
        })
    }
}

export default ROLE_API